package com.naiterui.ehp.bp.domain;

import static javax.persistence.GenerationType.IDENTITY;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

/**
 * 用药随访记录

 * @version 2016年11月8日 下午3:15:00
 */
@Entity
@Table(name = "dr_visit_record")
public class DrVisitRecord implements Serializable {

    /**
     * 订单中购药类型 ： 1.自主购药
     */
    public static final Integer VISIT_BUY_TYPE_SELF = 1;
    /**
     * 订单中购药类型 ： 2.单个推荐单
     */
    public static final Integer VISIT_BUY_TYPE_SINGLE_RECOM = 2;
    /**
     * 订单中购药类型 ： 3.多个推荐单
     */
    public static final Integer VISIT_BUY_TYPE_MULTI_RECOM = 3;
    /**
     * 订单中购药类型 ： 4.多个推荐&多个自主购药
     */
    public static final Integer VISIT_BUY_TYPE_RECOM_AND_SELF = 4;

    public static final Integer VISIT_STATUS_VISITED = 1;
    public static final Integer VISIT_STATUS_UNVISIT = 0;

    /**
     * @Fields serialVersionUID
     */
    private static final long serialVersionUID = 7018102402631733001L;
    private Long id;                // 随访记录id
    private Long patientId;         // 患者id
    private Long doctorId;          // 医生id
    private Long orderId;           // 订单id
    private Long templetId;         // 模板id
    private Integer status;         // 填写状态: 0.未填 1.已填
    private String serialNumber;    // 随访表编号
    private Date createdAt;         // 创建时间
    private Date changedAt;         // 修改时间

    private String visitDesc;       // IM窗口随访描述信息
    private Integer buyType;        // 订单中购药类型 1.自主购药 2.单个推荐单 3.多个推荐单 4.多个推荐&多个自主购药

    /**
     * 随访内容<br/><br/>
     * questionIndex 问题序号<br/>
     * answerType 回答类型 1:多选 2:填空<br/>
     * selection 选中值<br/>
     * answer 回答内容<br/><br/>
     * 格式如下：
     * <p><blockquote>
     * 
     * <pre>
        [
            {
                "questionIndex": 0,
                "answerType": 1,
                "selection": [
                  0,
                  2
                ]
            },
            {
                "questionIndex": 0,
                "answerType": 2,
                "answer": "用药之后好多了 "
            }
        ]
     * </pre>
     * 
     * </blockquote>
     * <p>
     */
    private String visitRecord;

    public DrVisitRecord() {
    }

    public DrVisitRecord(Long patientId, Long doctorId, Long orderId, Long templetId, String visitRecord, Integer status, String serialNumber,
            Integer buyType) {
        this.patientId = patientId;
        this.doctorId = doctorId;
        this.orderId = orderId;
        this.templetId = templetId;
        this.visitRecord = visitRecord;
        this.status = status;
        this.serialNumber = serialNumber;
        this.buyType = buyType;
        this.createdAt = new Date();
        this.changedAt = new Date();
    }

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "id", unique = true, nullable = false)
    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Column(name = "patient_id")
    public Long getPatientId() {
        return this.patientId;
    }

    public void setPatientId(Long patientId) {
        this.patientId = patientId;
    }

    @Column(name = "doctor_id")
    public Long getDoctorId() {
        return this.doctorId;
    }

    public void setDoctorId(Long doctorId) {
        this.doctorId = doctorId;
    }

    @Column(name = "order_id")
    public Long getOrderId() {
        return this.orderId;
    }

    public void setOrderId(Long orderId) {
        this.orderId = orderId;
    }

    @Column(name = "templet_id")
    public Long getTempletId() {
        return this.templetId;
    }

    public void setTempletId(Long templetId) {
        this.templetId = templetId;
    }

    @Column(name = "visit_record")
    public String getVisitRecord() {
        return this.visitRecord;
    }

    public void setVisitRecord(String visitRecord) {
        this.visitRecord = visitRecord;
    }

    @Column(name = "status")
    public Integer getStatus() {
        return this.status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    @Column(name = "created_at")
    public Date getCreatedAt() {
        return this.createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    @Column(name = "changed_at")
    public Date getChangedAt() {
        return this.changedAt;
    }

    public void setChangedAt(Date changedAt) {
        this.changedAt = changedAt;
    }

    @Column(name = "serial_number")
    public String getSerialNumber() {
        return this.serialNumber;
    }

    public void setSerialNumber(String serialNumber) {
        this.serialNumber = serialNumber;
    }

    @Column(name = "visit_desc")
    public String getVisitDesc() {
        return this.visitDesc;
    }

    public void setVisitDesc(String visitDesc) {
        this.visitDesc = visitDesc;
    }

    @Column(name = "buy_type")
    public Integer getBuyType() {
        return this.buyType;
    }

    public void setBuyType(Integer buyType) {
        this.buyType = buyType;
    }

}
